home *** CD-ROM | disk | FTP | other *** search
/ TOS Silver 2000 / TOS Silver 2000.iso / programm / GNU_C++ / LIB / CFLIB-11.LZH / src / intrface / extobfix.c < prev    next >
Encoding:
C/C++ Source or Header  |  1998-11-05  |  2.9 KB  |  122 lines

  1. /******************************************************************************/
  2. /*                                                                                                       */
  3. /* EXTOBFIX.C                                                                                          */
  4. /* für MagiC-Objekte und Erweiterungen der CF-Lib                                        */
  5. /* Datum: 11.03.98, CF                                                                              */
  6. /*                                                                                                       */
  7. /******************************************************************************/
  8.  
  9. #include <cflib.h>
  10.  
  11. #ifndef FALSE
  12. #define FALSE    0
  13. #define TRUE    1
  14. #endif
  15.  
  16. #include "exthelp.rsh"
  17. #include "exthelp.rh"
  18.  
  19. /****** Functions ************************************************************/
  20.  
  21. long    pinit_obfix(int status);
  22.  
  23. static void    fix_objs            (OBJECT *tree, int is_dialog);
  24. static void    (*get_name)        (void *window, int obj, BYTE *txt);
  25. static void    test_form        (OBJECT *tree, int editobj, long get_n, void *window);
  26. static int    test_alert        (int def, char *str);
  27.  
  28. /****** Variables ************************************************************/
  29.  
  30. static     long        routines[] =
  31. {
  32.     (long)fix_objs,
  33.     (long)test_alert,
  34.     (long)test_form,
  35.     (long)&rs_object[0],
  36.     '0610', '1965',                /* Magic */
  37.     (long)pinit_obfix,
  38. };
  39.  
  40. /*****************************************************************************/
  41.  
  42. static void fix_objs (OBJECT *tree, int is_dialog)
  43. {
  44.     fix_dial(tree);
  45. }
  46.  
  47. /*****************************************************************************/
  48.  
  49. static void test_form (OBJECT *tree, int editobj, long get_n, void *window)
  50. {
  51.     int    x, y, w, h, but, zw;
  52.     char    name[20], buf[80];
  53.         
  54.     *(long *)&get_name = get_n;
  55.     
  56.     fix_objs(tree, TRUE);
  57.  
  58.     wind_update(BEG_UPDATE);
  59.     form_center(tree, &x, &y, &w, &h);
  60.     form_dial(FMD_START, 0, 0, 0, 0, x, y, w, h);
  61.  
  62.     do
  63.     {
  64.         objc_draw(tree, ROOT, MAX_DEPTH, x, y, w, h); 
  65.         but = cf_form_do(tree, &editobj);
  66.         
  67.         /* keine TOUCHEXITs deselektieren */
  68.         if (get_flag(tree, but, EXIT))
  69.             set_state(tree, but, SELECTED, FALSE);
  70.  
  71.         (*get_name)(window, but, name);
  72.         sprintf(buf, rs_frstr[EXITALERT], but, name);
  73.         zw = do_alert(1, 2, buf);
  74.     }
  75.     while (zw == 1);
  76.  
  77.     form_dial(FMD_FINISH, 0, 0, 0, 0, x, y, w, h);
  78.     wind_update(END_UPDATE);
  79.     but = 0;
  80. }
  81.  
  82. /*****************************************************************************/
  83. static int test_alert(int def, char *str)
  84. {
  85.     return do_alert(def, 0, str);
  86. }
  87.  
  88. /*****************************************************************************/
  89.  
  90.  
  91. int main(void)
  92. {
  93.     static long dummy;
  94.  
  95.     appl_init();
  96.     form_alert(1, "[0][This program can|only be started from|Interface !][Cancel]");
  97.     dummy = routines[6]; /* Sonst wird die Struktur von Pure C wegoptimiert... */
  98.     appl_exit();
  99.     return 0;
  100. }
  101.  
  102. /*****************************************************************************/
  103.  
  104. long pinit_obfix (int status)
  105. {
  106.     int    i;
  107.  
  108.     if (status == TRUE)
  109.     {
  110.         init_app(NULL);
  111.  
  112.         /* Inline-RSC anpassen */
  113.         for (i = 0; i < NUM_OBS; i++)
  114.             rsrc_obfix(&rs_object[i], 0);
  115.         return ((long)routines);
  116.     }
  117.     else
  118.     {
  119.         exit_gem();
  120.       }
  121.     return 0;
  122. }